package ${(introspectedTable.tableConfiguration.properties.fileDirectoryServiceImpl)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryServiceImpl)?index_of("/src/main/java/")+15))?replace("/",".")};

import ${(introspectedTable.tableConfiguration.properties.fileDirectoryConvertBiz)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryConvertBiz)?index_of("/src/main/java/")+15))?replace("/",".")}.${className}Convert;
import com.broker.framework.common.pojo.CommonLongRespDTO;
import com.broker.framework.common.pojo.PageParam;
import com.broker.framework.common.pojo.PageResult;
import com.broker.framework.common.util.collection.MapUtils;
import ${(introspectedTable.tableConfiguration.properties.fileDirectoryDTO)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryDTO)?index_of("/src/main/java/")+15))?replace("/",".")}.${className}DTO;
import ${(introspectedTable.tableConfiguration.properties.fileDirectoryQueryDTO)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryQueryDTO)?index_of("/src/main/java/")+15))?replace("/",".")}.${className}QueryDTO;
import ${(introspectedTable.tableConfiguration.properties.fileDirectoryDO)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryDO)?index_of("/src/main/java/")+15))?replace("/",".")}.${className}DO;

import ${(introspectedTable.tableConfiguration.properties.fileDirectoryMapper)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryMapper)?index_of("/src/main/java/")+15))?replace("/",".")}.${className}Mapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Optional;
import java.util.List;

/***
 * ---------------------------
 * @Description: 表备注：${introspectedTable.remarks!}<#--deal null-->
 * 针对表【${introspectedTable.tableConfiguration.schema!}.${introspectedTable.fullyQualifiedTable.introspectedTableName}】的ServiceImpl
 * ---------------------------
* @author: ${introspectedTable.tableConfiguration.properties.auther!}
* @date: ${introspectedTable.tableConfiguration.properties.createTime!}
 * @version: v1.0
 * ---------------------------
 */
@Service
@Slf4j
public class ${className}ServiceImpl implements ${className}Service {

    @Resource
    private ${className}Mapper ${classNameTuoFeng}Mapper;


    @Override
    public ${className}DO get(Long id) {
        return ${classNameTuoFeng}Mapper.selectById(id);
    }

    @Override
    public PageResult<${className}DO> getPageByQueryDTO(${className}QueryDTO queryDTO, PageParam pageParam) {
        return ${classNameTuoFeng}Mapper.getPageByQueryDTO(queryDTO, pageParam);
    }


    @Override
    public List<${className}DTO> getListByQueryDTO(${className}QueryDTO queryDTO) {
        return ${className}Convert.INSTANCE.convertToDTOList(${classNameTuoFeng}Mapper.getListByQueryDTO(queryDTO));
    }

    @Override
    public ${className}DTO getOneByQueryDTO(${className}QueryDTO queryDTO) {
        return ${className}Convert.INSTANCE.convertToDTO(${classNameTuoFeng}Mapper.getOneByQueryDTO(queryDTO));
    }

    @Override
    public CommonLongRespDTO countByQueryDTO(${className}QueryDTO queryDTO) {
        return ${classNameTuoFeng}Mapper.countByQueryDTO(queryDTO);
    }

    @Override
    public void deleteByQueryDTO(${className}QueryDTO queryDTO) {
        ${classNameTuoFeng}Mapper.deleteByQueryDTO(queryDTO);
    }

<#list introspectedTable.nonPrimaryKeyColumns as baseColumns>
        <#if baseColumns.actualColumnName?last_index_of("_id")!=-1 && baseColumns.actualColumnName !="tenant_id">
    @Override
    public List<${className}DTO> getBy${baseColumns.javaProperty?cap_first}(${baseColumns.fullyQualifiedJavaType.shortNameWithoutTypeArguments} ${baseColumns.javaProperty}) {
        List<${className}DO> ${classNameTuoFeng}DOs = ${classNameTuoFeng}Mapper.selectListBySelector(MapUtils.ofNullable(${className}DO::get${baseColumns.javaProperty?cap_first}, ${baseColumns.javaProperty}));
        return ${className}Convert.INSTANCE.convertToDTOList(${classNameTuoFeng}DOs);
    }
        </#if>
</#list>


}